package com.test.controller.Admininfo;

import com.test.entity.*;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@NoArgsConstructor
public class MyObject {
//    部门信息
    private LeaderInfo leaderInfo;
//    Hr信息
    private HrInfo hrInfo;
//    财务信息
    private CwInfo cwInfo;
//    员工信息
    private StaffInfo staffInfo;
//    部门信息
    private DepartInfo departInfo;
//    职位信息
    private JobInfo jobInfo;
//    公告信息
    private NoticeInfo noticeInfo;
//    请假信息
    private LeaveInfo leaveInfo;
//    报销信息
    private BxMsg bxMsg;
//    文件信息
    private FileInfo fileInfo;
//    通讯录信息
    private TxInfo txInfo;
//    任务信息
    private TaskInfo taskInfo;
//    员工计划
    private PlanInfo planInfo;
//    考勤计划
    private AttendLog attendLog;

    private String sexStr;//性别
    private String departIdStr;//所属部门
    private String jobIdStr;//职位信息

    private String attendStatusStr;

    private String leaveTypeStr;//请假类型
    private String leaveStatusStr;//请假状态

    private String bxStatusStr;//报销状态

    private String staffIdStr;//员工姓名
    private String leaderIdStr;//领导姓名

    public MyObject(AttendLog attendLog){
        this.attendLog = attendLog;
        if (attendLog.getAttendStatus()!=null){
            if (attendLog.getAttendStatus()==1){
                this.attendStatusStr="正常";
            }else if (attendLog.getAttendStatus()==2){
                this.attendStatusStr="迟到";
            }else {
                this.attendStatusStr="缺勤";
            }
        }

    }
//    任务
    public MyObject(TaskInfo taskInfo){
        this.taskInfo=taskInfo;
        this.staffIdStr = taskInfo.getStaffIdStr();
        this.leaderIdStr = taskInfo.getLeaderIdStr();
    }
//    部门领导
    public MyObject(LeaderInfo leaderInfo) {
        this.sexStr=leaderInfo.getSex()==1?"男":"女";
        this.departIdStr=leaderInfo.getDepartIdStr();
        this.leaderInfo = leaderInfo;
    }
//    hr
    public MyObject(HrInfo hrInfo) {
        this.hrInfo = hrInfo;
    }
//    财务
    public MyObject(CwInfo cwInfo) {
        this.cwInfo = cwInfo;
    }
//    员工
    public MyObject(StaffInfo staffInfo){
        this.sexStr = staffInfo.getSex()==1?"男":"女";
        this.departIdStr = staffInfo.getDepartIdStr();
        this.jobIdStr = staffInfo.getJobStr();
        this.staffInfo = staffInfo;
    }
//    部门
    public MyObject(DepartInfo departInfo){
        this.departInfo=departInfo;
    }
//    职位信息
    public MyObject(JobInfo jobInfo){
        this.jobInfo = jobInfo;
        this.departIdStr = jobInfo.getDepartIdStr();
    }
//    公告信息
    public MyObject(NoticeInfo noticeInfo){
        this.noticeInfo = noticeInfo;
    }
//    请假管理
    public MyObject(LeaveInfo leaveInfo){
        this.leaveInfo = leaveInfo;
        this.leaveTypeStr = leaveInfo.getLeaveType()==1? "病假":"事假";
        if (leaveInfo.getLeaveStatus()==1) {
            this.leaveStatusStr="已申请";
        }else if (leaveInfo.getLeaveStatus()==2){
            this.leaveStatusStr="已同意";
        }else if (leaveInfo.getLeaveStatus()==3){
            this.leaveStatusStr="已驳回";
        }else {
            this.leaveStatusStr="已销假";
        }

    }
//    报销管理
    public MyObject(BxMsg bxMsg){
        this.bxMsg = bxMsg;
        if (bxMsg.getBxStatus()==1){
            this.bxStatusStr="申请中";
        }else if (bxMsg.getBxStatus()==2){
            this.bxStatusStr="报销通过";
        }else {
            this.bxStatusStr="报销不通过";
        }
    }
//    文件管理
    public MyObject(FileInfo fileInfo){
        this.fileInfo = fileInfo;
    }
//    通讯录管理
    public MyObject(TxInfo txInfo){
        System.out.println(txInfo.toString());
        this.txInfo=txInfo;
        this.sexStr=txInfo.getSex()==1?"男":"女";
        this.departIdStr=txInfo.getDepartIdStr();
        this.jobIdStr=txInfo.getJobIdStr();
    }
//    员工计划
    public MyObject(PlanInfo planInfo){
        this.planInfo=planInfo;
        this.departIdStr=planInfo.getDepartIdStr();
    }


}
